package com.yxwl.demo.ui.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.yxwl.demo.R;
import com.yxwl.demo.bean.PrinterInfoBean;


public class PrinterInfoAdapter extends BaseRecyclerViewAdapter<PrinterInfoBean> {


    public PrinterInfoAdapter(Context context) {
        super(context);
    }

    @Override
    protected int getLayoutId(ViewGroup parent, int position) {
        return R.layout.item_info;
    }

    @Override
    protected void bindData(BaseViewHolder holder, PrinterInfoBean data, int position) {
        super.bindData(holder, data, position);
        if (data == null || data.title == null || data.value == null) {
            return;
        }
        View view = holder.getView(R.id.item_set);
        if (data.title.contains("浓度")
                || data.title.contains("速度")
                || data.title.contains("待机")) {
            view.setVisibility(View.VISIBLE);
            setViewClick(view, 1, position, data);
        } else {
            view.setVisibility(View.GONE);
        }

        ((TextView) holder.getView(R.id.item_title)).setText(data.title);
        ((TextView) holder.getView(R.id.item_value)).setText(data.value.trim());
    }

}